<style>
    input[readonly]{
        background : #ddd;
        border : 1px solid #eee ;
        cursor : pointer;
    }
    .currency{
        text-align:right;
    }
</style>
<!-- file document -->
<script> 
	
	$(function(){
		/***********************************************
		
			field.datepicker({ dateFormat : 'dd-mm-yy'});
			field.getCombobox({ task : "task"},"id","name");

		************************************************/
		
	
		/* REMOVE DUPLICATE ID */
		var ids = [];
		$('*').each(function() {
		    if (this.id && this.id !== '') {
		        if (ids[this.id]) {
		            $(this).remove();
		        } else {
		            ids[this.id] = this
		        }
		    }
		});
		
		$.fn.getCombobox = function(data, key, label){
			var field = $(this);
			$.ajax({
				url : "c_public_function",
				data : data,
				type : 'POST', dataType : 'json'
			}).done(function(response){
                field.html("<option></option>");
				for(i=0;i<response.length;i++){
					field.append("<option value="+response[i][key]+">"+response[i][label]+"</option>");
				}
					field.chosen();
			});
		}
		
		/* external function */
		
		$.fn.serializeObject = function()
		{
		   var o = {};
		   var a = this.serializeArray();
		   $.each(a, function() {
			   if (o[this.name]) {
				   if (!o[this.name].push) {
					   o[this.name] = [o[this.name]];
				   }
				   o[this.name].push(this.value || '');
			   } else {
				   o[this.name] = this.value || '';
			   }
		   });
		   return o;
		};
		
		/* declarisasi */
		
		task_document = $("#task_document");
		grid_document = $("#grid-document");
		pgrid_document = $("#pgrid-document");
		btnadd_document = $("#btn-add-document");
		btnedit_document = $("#btn-edit-document");
		btnprocess_document = $("#btn-process-document");
		btndelete_document = $("#btn-delete-document");
		btncancel_document =  $("#btn-cancel-document");
		btnsave_document = $("#btn-save-document");
		btnaruskas_document = $("#btn-aruskas-document");
        
		form_document = $("#form-document");
		
		field_document_id = $("#document_id");
		field_document_no = $("#document_no");
		field_document_noflow = $("#document_noflow");
		field_document_noproyek = $("#document_noproyek");
		field_document_holdpoint = $("#document_holdpoint");
		field_t_project_id = $("#t_project_id");
		field_m_flow_id = $("#m_flow_id");
		
		form_process = $("#form-process");
        form_aruskas = $("#form-aruskas");
		btncancel_aruskas =  $("#btn-cancel-aruskas");
		field_process_document_id = $("#process_document_id");
		field_process_document_no = $("#process_document_no");
		field_process_t_project_id = $("#process_t_project_id");
		field_checklist = $("#checklist");
		field_process_flag = $("#process_flag");
		field_max_tracking_seq = $("#max_tracking_seq");
		field_nextuser = $("#nextuser");
		field_tracking_keterangan = $("#tracking_keterangan");
		btncancel_process =  $("#btn-cancel-process");
		btnsave_process = $("#btn-save-process");
		tahapan = $("#tahapan");
		checklisting = $("#checklisting");
		
		field_aruskas_document_id = $("#aruskas_document_id");
		field_aruskas_document_no = $("#aruskas_document_no");
		field_aruskas_t_project_id = $("#aruskas_t_project_id");
        field_aruskas_project_value = $("#aruskas_project_value");
        field_aruskas_project_nkppn = $("#aruskas_project_nkppn");
        
        field_aruskas_project_rapk = $("#aruskas_project_rapk");
        field_aruskas_project_pph = $("#aruskas_project_pph");
        field_aruskas_project_rapkpph = $("#aruskas_project_rapkpph");
        field_aruskas_project_ppn = $("#aruskas_project_ppn");
        field_aruskas_project_rapkpphppn = $("#aruskas_project_rapkpphppn");
        
        field_aruskas_persen_rapk = $("#aruskas_persen_rapk");
        field_aruskas_persen_pph = $("#aruskas_persen_pph");
        field_aruskas_persen_rapkpph = $("#aruskas_persen_rapkpph");
        field_aruskas_persen_ppn = $("#aruskas_persen_ppn");
        field_aruskas_persen_rapkpphppn = $("#aruskas_persen_rapkpphppn");
        
        field_detail_aruskas_nkppn = $("#detail_aruskas_nkppn");
        field_detail_aruskas_raptotal = $("#detail_aruskas_raptotal");
        field_detail_aruskas_rapflow = $("#detail_aruskas_rapflow");
        
        field_detail_aruskas_persen_nkppn = $("#detail_aruskas_persen_nkppn");
        field_detail_aruskas_persen_raptotal = $("#detail_aruskas_persen_raptotal");
        field_detail_aruskas_persen_rapflow = $("#detail_aruskas_persen_rapflow");
        
        field_detail_aruskas_rapflow = $("#detail_aruskas_rapflow");
        field_detail_aruskas_persen_rapflow = $("#detail_aruskas_persen_rapflow");
        field_detailflow_aruskas_dropcash = $("#detailflow_aruskas_dropcash");
        field_detailflow_aruskas_persen_dropcash = $("#detailflow_aruskas_persen_dropcash");
        field_dropcash_arus_dropreg = $("#dropcash_arus_dropreg");
        field_dropcash_arus_potpph = $("#dropcash_arus_potpph");
        
        field_detailflow_aruskas_dropncl = $("#detailflow_aruskas_dropncl");
        field_detailflow_aruskas_persen_dropncl = $("#detailflow_aruskas_persen_dropncl");
        field_dropncl_arus_skbdn = $("#dropncl_arus_skbdn");
        field_dropncl_arus_skbdnpayung = $("#dropncl_arus_skbdnpayung");
        field_dropncl_arus_kmk = $("#dropncl_arus_kmk");
        field_dropncl_arus_scf = $("#dropncl_arus_scf");
        
        
        field_detailflow_aruskas_rappph = $("#detailflow_aruskas_rappph");
        field_detailflow_aruskas_persen_rappph = $("#detailflow_aruskas_persen_rappph");
        field_detailflow_aruskas_rapppn = $("#detailflow_aruskas_rapppn");
        field_detailflow_aruskas_persen_rapppn = $("#detailflow_aruskas_persen_rapppn");
        
        field_detail_aruskas_rapnonflow = $("#detail_aruskas_rapnonflow");
        field_detail_aruskas_persen_rapnonflow = $("#detail_aruskas_persen_rapnonflow");
        loading = $(".loading");
        
		/* method started */
		
		$( "input[type=submit],input[type=button],input[type=reset], button" ).button();
			
		/* make component */
		
		field_t_project_id.getCombobox({ task : "project"},"project_id","project_name");
			
		grid_document.jqGrid({ 
			ajaxGridOptions : {type:"POST"},
			serializeGridData : function(postdata) {return postdata; },
			postData : {task : 'LIST', flow_id : '<?php echo $flow ; ?>'},
            url: 'c_document',
			datatype: "json", 
			colNames:[
				'Kode Proyek',
				'Proyek',
				'No Documen',
				'Posisi',
				't_project_id',
				'project_id',
				'div_id',
				'm_flow_id',
				'flowdet_id',
				'nextuser',
				'tracking_flag',
				'max_tracking_seq',
				'document_noflow',
				'document_noproyek',
				'proyek_value',
				'document_no',
				'document_id'],
			colModel:[
				{ name: 'project_code'  ,index: 'project_code' , search : true},
				{ name: 'project_name'  ,index: 'project_name' , search : true},
				{ name: 'document_noall'  ,index: 'document_noall' , search : true},
				{ name: 'div_name'  ,index: 'div_name' , search : true},
				{ name: 't_project_id'  ,index: 't_project_id' , search : true , hidden : true},
				{ name: 'project_id'  ,index: 'project_id' , search : true , hidden : true},
				{ name: 'div_id'  ,index: 'div_id' , search : false, hidden : true},
				{ name: 'm_flow_id'  ,index: 'm_flow_id' , search : false, hidden : true},
				{ name: 'flowdet_id'  ,index: 'flowdet_id' , search : true, hidden : true},
				{ name: 'nextuser'  ,index: 'nextuser' , search : true, hidden : true},
				{ name: 'tracking_flag'  ,index: 'tracking_flag' , search : true, hidden : true},
				{ name: 'max_tracking_seq'  ,index: 'max_tracking_seq' , search : true, hidden : true},
				{ name: 'document_noflow'  ,index: 'document_noflow' , search : true, hidden : true},
				{ name: 'document_noproyek'  ,index: 'document_noproyek' , search : true, hidden : true},
				{ name: 'document_no'  ,index: 'document_no' , search : true, hidden : true},
				{ name: 'project_value'  ,index: 'project_value', hidden: true , search : false},
				{ name: 'document_id'  ,index: 'document_id', hidden: true , search : false}
			],
			width: '700',
			height: 'auto',
			rowNum:10, 
			rowList:[10,20,30], 
			pager: '#pgrid-document', 
			sortname: 'document_id', 
			viewrecords: true, 
			sortorder: "desc",
			caption:"" ,
           onSelectRow : function (a){
                id = grid_document.jqGrid("getGridParam","selrow");
                dataRow = grid_document.getRowData(id);
                console.log(dataRow);
                if (dataRow.document_noall == ""){
                    btnadd_document.show();
                    btnprocess_document.hide();
                }else{
                    if ('<?php echo @$flow_subcode; ?>' == ''){
                        btnadd_document.hide();
                    }else{
                        btnadd_document.show();
                    }
                    btnprocess_document.show();
                }
            }
		}); 
		grid_document.jqGrid('navGrid','#pgrid-document',{edit:false,add:false,del:false,search:false});
		grid_document.jqGrid('filterToolbar',{});
		
		form_document.dialog({
			autoOpen: false,
			height: "300",
			width: "450",
			modal: true
		});
		
		form_process.dialog({
			autoOpen: false,
			height: "500",
			width: "500",
			modal: true
		});
        
        form_aruskas.dialog({
			autoOpen: false,
			height: "auto",
			width: "auto",
			modal: true
		});
        
		/* general event */
		$(".currency").keyup(function(){
			$(this).formatCurrency();
		});
		
		/* event */

		btnedit_document.click(function(){
			id = grid_document.jqGrid("getGridParam","selrow");
			if (id != null){
				task_document.val("UPDATE");
				dataRow = grid_document.getRowData(id);
				field_document_id.val(dataRow.document_id);
				field_document_no.val(dataRow.document_no);
				field_document_noflow.val(dataRow.document_noflow);
				field_document_noproyek.val(dataRow.document_noproyek);
				
				field_t_project_id.val(dataRow.t_project_id);
				field_t_project_id.trigger("chosen:updated");
				field_m_flow_id.val(dataRow.m_flow_id);
				form_document.dialog("open");
			}
		});
		
		btndelete_document.click(function(){
			id = grid_document.jqGrid("getGridParam","selrow");
			if (id != null){
				confr = confirm("Apa Anda yakin menghapus data ini?");
				if (confr){
					$.ajax({
						type: 'POST',
						url: 'c_document',
						data: {document_id: id, task : 'DELETE'},
						success: function(response){
							if(response==1){
								grid_document.trigger('reloadGrid');
								$("#grid-document").trigger('reloadGrid');
							}
						}
					});
				}
			}
		});
		
		btnadd_document.click(function(){
			btncancel_document.click();
			id = grid_document.jqGrid("getGridParam","selrow");
            
			if (id != null){
			
            dataRow = grid_document.getRowData(id);
            console.log(dataRow );
            
				field_t_project_id.val(dataRow.project_id);
				field_t_project_id.trigger("chosen:updated");
            field_t_project_id.change();
			task_document.val("INSERT");
			form_document.dialog("open");
            }else{
                alert("Silakan pilih dokumen yang akan diproses!");   
            }
		});
		
		btnprocess_document.click(function(){
			id = grid_document.jqGrid("getGridParam","selrow");
			if (id != null){
				grouptipe = '<?php echo @$_SESSION[SESSION_GROUPTIPE]; ?>';
				div_id = '<?php echo @$_SESSION[SESSION_DIV]; ?>';
				user_id = '<?php echo @$_SESSION[SESSION_USERID]; ?>';
				dataRow = grid_document.getRowData(id);
				
				if (grouptipe != 2 && div_id != dataRow.div_id){
                    if (dataRow.div_name != "Selesai")
                    alert("Maaf user harus sign in sebagai "+dataRow.div_name+" untuk memproses dokumen ini!");
                    else
                        alert("Dokumen ini telah selesai diproses!");
			//		alert("Maaf user tidak dapat memproses dokumen yang sedang berada di divisi lain! ");
				}else{
					field_process_document_id.val(dataRow.document_id);
					field_process_document_no.val(dataRow.document_noall);
					field_process_t_project_id.val(dataRow.project_name);
					field_max_tracking_seq.val(dataRow.max_tracking_seq);
					field_nextuser.val(dataRow.nextuser);
					field_process_flag.val(dataRow.tracking_flag);
					
					checklisting.show();
					if (dataRow.nextuser == "1"){
						tahapan.show();
						if (field_process_flag.val() < 5){
							checklisting.hide();
						}
					}else{
						tahapan.hide();
					}
					
					$.ajax({
						url : "c_public_function",
						data : {task : "checklistbyflowdet", flowdet_id : dataRow.flowdet_id, last : '<?php echo @$last; ?>', document_id : dataRow.document_id},
						type : 'POST', dataType : 'json'
					}).done(function(response){
						field_checklist.html("");
						for(i=0;i<response.length;i++){
							// field_checklist.append("<option value="+response[i][key]+">"+response[i][label]+"</option>");
							// field_checklist.append("<tr><td>"+response[i].checklist_name+
								// "&nbsp;</td><td><select name='checklist["+response[i].flowdetchecklist_id+"]'><option value='1'>Tidak Ada</option>"+
								// "<option value='2'>Setuju</option><option value='3'>Tolak</option>"+
								// "</select></td></tr>");
											field_checklist.append("<tr><td>"+response[i].checklist_name+
								"&nbsp;</td><td><input type='radio' name='checklist["+response[i].flowdetchecklist_id+"]' value='1'> Tidak Ada &nbsp;"+
								"<input  type='radio' name='checklist["+response[i].flowdetchecklist_id+"]' value='2'>Setuju "+
								" </td></tr>");
						}
					});
				
					form_process.dialog("open");
				}
			}else{
                alert("Silakan pilih dokumen yang akan diproses!");   
            }
		});
		
        btnaruskas_document.click(function(){
			id = grid_document.jqGrid("getGridParam","selrow");
			if (id != null){
				dataRow = grid_document.getRowData(id);
                
				grouptipe = '<?php echo @$_SESSION[SESSION_GROUPTIPE]; ?>';
				div_id = '<?php echo @$_SESSION[SESSION_DIV]; ?>';
				user_id = '<?php echo @$_SESSION[SESSION_USERID]; ?>';
				dataRow = grid_document.getRowData(id);
				
				if (6 != dataRow.div_id){
                    alert("Dokumen tidak berada di PM");
                }else{
                    field_aruskas_document_id.val(dataRow.document_id);
                    field_aruskas_document_no.val(dataRow.document_noall);
                    field_aruskas_t_project_id.val(dataRow.project_name);
                    field_aruskas_project_value.val(dataRow.project_value);
                    field_aruskas_project_nkppn.val((dataRow.project_value * 100 / 110).toFixed(0));
                    $(".currency").formatCurrency();
                    
                    field_detail_aruskas_nkppn.val(field_aruskas_project_nkppn.val());
                    
                    form_aruskas.dialog("open");
                }
            }else{
                alert("Silakan pilih dokumen terlebih dahulu!");   
            }
        });
        btncancel_aruskas.click(function(){

            form_aruskas.dialog("close");
        });
        
		btncancel_document.click(function(){
			form_document.dialog("close");
            field_t_project_id.val("");
            field_t_project_id.trigger("chosen:updated");
		});
        
		btncancel_process.click(function(){
			form_process.dialog("close");
            field_t_project_id.val("");
            field_t_project_id.trigger("chosen:updated");
		});
        
		btnsave_document.click(function(){
            loading.show();
            btnsave_document.attr("disabled","disabled");
			data = form_document.serializeObject();
			$.ajax({
				url : "c_document",
				data : data,
				type : 'POST'
			}).done(function(response){
                loading.hide();
                btnsave_document.removeAttr("disabled");
				grid_document.trigger('reloadGrid');
				btncancel_document.click();
			});
		});
		
		btnsave_process.click(function(){
            loading.show();
            btnsave_process.attr("disabled","disabled");
			data = form_process.serializeObject();
			$.ajax({
				url : "c_document",
				data : data,
				type : 'POST'
			}).done(function(response){
                loading.hide();
                btnsave_process.removeAttr("disabled");
				grid_document.trigger('reloadGrid');
				btncancel_process.click();
			});
		});
		
		field_process_flag.change(function(){
			if (field_process_flag.val() < 5){
				checklisting.hide();
			}else{
				checklisting.show();
			}
		});
		
		field_t_project_id.change(function(){
			$.ajax({
				url : "c_public_function",
				data : { task : 'getnodocumen', project_id : $(this).val(), flow_id : <?php echo $flow; ?> },
				type : 'POST',
                dataType : 'json'
			}).done(function(response){
				field_document_noproyek.val(response.project_code);
				field_document_no.val(response.seq);
			});
		});
        
        field_aruskas_persen_rapk.keyup(function(){
            var nkppn = field_aruskas_project_nkppn.asNumber();
            var persen = field_aruskas_persen_rapk.val().replace(",",".");
            field_aruskas_project_rapk.val(Math.ceil(nkppn * persen / 100));
            field_aruskas_project_rapk.formatCurrency();
        });
        
        field_aruskas_persen_pph.keyup(function(){
            var nkppn = field_aruskas_project_nkppn.asNumber();
            var persen = field_aruskas_persen_pph.val().replace(",",".");
            field_aruskas_project_pph.val(Math.ceil(nkppn * persen / 100));
            field_aruskas_project_pph.formatCurrency();
        });
        
        field_aruskas_persen_rapkpph.keyup(function(){
            var nkppn = field_aruskas_project_nkppn.asNumber();
            var persen = field_aruskas_persen_rapkpph.val().replace(",",".");
            field_aruskas_project_rapkpph.val(Math.ceil(nkppn * persen / 100));
            field_aruskas_project_rapkpph.formatCurrency();
        });
        
        field_aruskas_persen_ppn.keyup(function(){
            var nkppn = field_aruskas_project_nkppn.asNumber();
            var persen = field_aruskas_persen_ppn.val().replace(",",".");
            field_aruskas_project_ppn.val(Math.ceil(nkppn * persen / 100));
            field_aruskas_project_ppn.formatCurrency();
        });
        
        field_aruskas_persen_rapkpphppn.keyup(function(){
            var nkppn = field_aruskas_project_nkppn.asNumber();
            var persen = field_aruskas_persen_rapkpphppn.val().replace(",",".");
            field_aruskas_project_rapkpphppn.val(Math.ceil(nkppn * persen / 100));
            field_aruskas_project_rapkpphppn.formatCurrency();
        });
        
        function sum_raptotal(){
        
            var nkppn = field_aruskas_project_nkppn.asNumber();
            rapflow = field_detail_aruskas_rapflow.asNumber();
            rapnonflow = field_detail_aruskas_rapnonflow.asNumber();
            raptotal = rapflow + rapnonflow;
            persen = (raptotal / nkppn * 100);
            field_detail_aruskas_raptotal.val(raptotal);
            field_detail_aruskas_raptotal.formatCurrency();
            field_detail_aruskas_persen_raptotal.val(persen.toFixed(2));
        }
        
        field_detail_aruskas_persen_rapnonflow.keyup(function(){
            var nkppn = field_aruskas_project_nkppn.asNumber();
            var persen = field_detail_aruskas_persen_rapnonflow.val().replace(",",".");
            field_detail_aruskas_rapnonflow.val(Math.ceil(nkppn * persen / 100));
            field_detail_aruskas_rapnonflow.formatCurrency();
            sum_raptotal();
        });
        
        function sum_rapflow(){
            var nkppn = field_aruskas_project_nkppn.asNumber();
            dropcash = field_detailflow_aruskas_dropcash.asNumber();
            dropncl = field_detailflow_aruskas_dropncl.asNumber();
            rappph = field_detailflow_aruskas_rappph.asNumber();
            rapppn = field_detailflow_aruskas_rapppn.asNumber();
            rapflow = dropcash + dropncl + rappph + rapppn;
            persen = (rapflow / nkppn * 100);
            field_detail_aruskas_rapflow.val(rapflow);
            field_detail_aruskas_rapflow.formatCurrency();
            field_detail_aruskas_persen_rapflow.val(persen.toFixed(2));
            sum_raptotal();
        }
        
        field_detailflow_aruskas_persen_rappph.keyup(function(){
            var nkppn = field_aruskas_project_nkppn.asNumber();
            var persen = field_detailflow_aruskas_persen_rappph.val().replace(",",".");
            field_detailflow_aruskas_rappph.val(Math.ceil(nkppn * persen / 100));
            field_detailflow_aruskas_rappph.formatCurrency();
            sum_rapflow();
        });
        
        field_detailflow_aruskas_persen_rapppn.keyup(function(){
            var nkppn = field_aruskas_project_nkppn.asNumber();
            var persen = field_detailflow_aruskas_persen_rapppn.val().replace(",",".");
            field_detailflow_aruskas_rapppn.val(Math.ceil(nkppn * persen / 100));
            field_detailflow_aruskas_rapppn.formatCurrency();
            sum_rapflow();
        });
        
        function sum_dropcash(){
        
            var nkppn = field_aruskas_project_nkppn.asNumber();
            var dropreg = field_dropcash_arus_dropreg.asNumber();
            var potpph = field_dropcash_arus_potpph.asNumber();
            var dropcash = dropreg + potpph;
            var persen = (dropcash / nkppn * 100);
            field_detailflow_aruskas_dropcash.val(dropcash);
            field_detailflow_aruskas_dropcash.formatCurrency();
            field_detailflow_aruskas_persen_dropcash.val(persen.toFixed(2));
            sum_rapflow();
        }
        
        field_dropcash_arus_dropreg.keyup(function(){
            sum_dropcash();
        });
        
        field_dropcash_arus_potpph.keyup(function(){
            sum_dropcash();
        });
        
        function sum_dropncl(){
        
            var nkppn = field_aruskas_project_nkppn.asNumber();
            var skbdn = field_dropncl_arus_skbdn.asNumber();
            var skbdnpayung = field_dropncl_arus_skbdnpayung.asNumber();
            var kmk = field_dropncl_arus_kmk.asNumber();
            var scf = field_dropncl_arus_scf.asNumber();
            var dropncl = skbdn + skbdnpayung + kmk + scf;
            var persen = (dropncl / nkppn * 100);
            field_detailflow_aruskas_dropncl.val(dropncl);
            field_detailflow_aruskas_dropncl.formatCurrency();
            field_detailflow_aruskas_persen_dropncl.val(persen.toFixed(2));
            sum_rapflow();
        }
        
        field_dropncl_arus_skbdn.keyup(function(){
            sum_dropncl();
        });
        
        field_dropncl_arus_skbdnpayung.keyup(function(){
            sum_dropncl();
        });
        
        field_dropncl_arus_kmk.keyup(function(){
            sum_dropncl();
        });
        
        field_dropncl_arus_scf.keyup(function(){
            sum_dropncl();
        });
        
	});
</script>

	<table id="grid-document" class="table table-striped table-bordered" ></table>
	<div id="pgrid-document"></div>
	
	<button id="btn-delete-document"  style="display:none;">Batalkan</button>
	
	<?php if((@$pos == 1 || $_SESSION[SESSION_GROUPTIPE] == 2) ) {  ?>
    <?php if ($_SESSION[SESSION_GROUPTIPE] == 2) { ?>
	<button id="btn-add-document">Inisialisasi</button>
    <?php }else{ ?>
	<button id="btn-add-document">Proses</button>
    <?php } ?>
	<!-- button id="btn-edit-document" >Ubah</button -->
	<?php } 
	if (@$pos != 1  || $_SESSION[SESSION_GROUPTIPE] == 2){ ?>
	<button id="btn-process-document">Proses</button>
	<?php } ?>

	<?php if ((@$_SESSION[SESSION_DIV] == 6   || $_SESSION[SESSION_GROUPTIPE] == 2 ) && @$flow_code == "AK" ){ ?>
	<button id="btn-aruskas-document">Input Arus kas</button>
	<?php } ?>
	
	<form id="form-document" title="document" disabled=true>
		<input type="hidden" value="INSERT" name="task" id="task_document">
	   <table>
			<tr style="display: none">
				<td align="right">document_id:</td>
				<td align="left"><input id="document_id" name="document_id" /></td>
			</tr>
			
			<tr > <td align="right">Proyek:</td> <td align="left"><select style="width:250px;"  id="t_project_id" name="t_project_id" ><option /></select></td> </tr>
			
			<tr > <td align="right">No Dokumen:</td> <td align="left">
			<input id="document_noflow" value="<?php echo @$flow_code; ?>" name="document_noflow" readonly=readonly style="width:60px;" />
			<input id="document_noproyek" name="document_noproyek" style="width:60px;" readonly=readonly />
			<input id="document_no" name="document_no" style="width:60px;" readonly=readonly />
			</td> </tr>
			
			<tr > <td align="right">Hold point:</td> <td align="left"><input type=text style="width:100px;"  id="document_holdpoint" name="document_holdpoint" ></td> </tr>
           
			<tr style="display:none" > <td align="right">m_flow_id:</td> <td align="left"><input id="m_flow_id" name="m_flow_id" value="<?php echo $flow; ?>" /></td> </tr>
			
			<tr>
				<td align="right"><img hidden=hidden class="loading" src="<?php echo base_url("../") ?>assets/images/loader.gif" width=36 height=36>
                </td>
				<td style="padding-top: 10px;" align="right">
					<input style="margin-right: 5px;" type="button" id="btn-save-document" value="Simpan"  />
					<input id="btn-cancel-document" type="reset" value="Batal" /></td>
			</tr>
		</table>
	</form>
	
	
	<form id="form-process" title="Proses" disabled=true>
		<input type="hidden" value="PROCESS" name="task">
		<input type="hidden" value="0" name="max_tracking_seq" id="max_tracking_seq">
		<input type="hidden" value="0" name="nextuser" id="nextuser">
	   <table>
			<tr style="display: none">
				<td align="right">document_id:</td>
				<td align="left"><input id="process_document_id" name="t_document_id" /></td>
			</tr>
			
			<tr > <td align="right">No Dokumen:</td> <td align="left"><input id="process_document_no" readonly=readonly name="document_no" style="width:200px;" /></td> </tr>
			<tr > <td align="right">Proyek:</td> <td align="left"><input id="process_t_project_id" readonly=readonly name="t_project_id" style="width:200px;" /></td> </tr>
			
			<tr ><td>
			&nbsp;
			</td> </tr><tr  id="checklisting"> <td align="right" valign="top">Checklist:</td> <td align="left">
			<table id="checklist"></table>
			</td> </tr>
			<tr ><td>
			&nbsp;
			</td> </tr>
			<tr id="tahapan" > <td align="right" valign="top">Tahap:</td> <td align="left">
			<select name="process_flag" id="process_flag">
				<option value="1">Diterima</option>
				<option value="2">Diproses</option>
				<option value="6">Ditolak</option>
				<option value="5">Selesai</option>
			</select>
			</td> </tr>
           <tr> <td align="right" valign="top">Keterangan:</td> <td align="left">
			<textarea name="tracking_keterangan" id="tracking_keterangan" style="width:100</td><td>%</td>;height:100px;"></textarea>
			</td> </tr>
			
			<tr>
				<td align="right"><img hidden=hidden class="loading" src="<?php echo base_url("../") ?>assets/images/loader.gif" width=36 height=36></td>
				<td style="padding-top: 10px;" align="right">
					<input style="margin-right: 5px;" type="button" id="btn-save-process" value="Process"  />
					<input id="btn-cancel-process" type="reset" value="Batal" /></td>
			</tr>
		</table>
	</form>


	<form id="form-aruskas" title="Arus Kas" disabled=true>
		<input type="hidden" value="ARUSKAS" name="task">
	   <table>
			<tr style="display: none">
				<td align="left">document_id:</td>
				<td align="left"><input id="aruskas_document_id" name="t_document_id" /></td>
			</tr>
			
			<tr > <td align="left" width="240px">No Dokumen:</td> <td align="left"><input id="aruskas_document_no" readonly=readonly name="document_no" style="width:200px;" /></td> </tr>
			<tr > <td align="left">Proyek:</td> <td align="left"><input id="aruskas_t_project_id" readonly=readonly name="t_project_id" style="width:200px;" /></td> </tr>
           
           <tr > <td align="left">Nilai Kontrak ( NK ):</td> <td align="left"><input id="aruskas_project_value" readonly=readonly name="project_value" style="width:200px;" class="currency" /></td> </tr>
           <tr > <td align="left">NK - PPN:</td> <td align="left"><input id="aruskas_project_nkppn" readonly=readonly style="width:200px;" class="currency" /></td></tr>
           <tr > <td align="left">RAPK:</td> <td align="left"><input id="aruskas_project_rapk" readonly=readonly name="project_rapk" style="width:200px;" class="currency" /></td><td><input id="aruskas_persen_rapk" type="text" style="width:50px;" ></td><td>%</td></tr>
           <tr > <td align="left">PPH FINAL:</td> <td align="left"><input id="aruskas_project_pph" class="currency" readonly=readonly name="project_pph" style="width:200px;" /></td><td><input id="aruskas_persen_pph"  type="text" style="width:50px;" ></td><td>%</td></tr>
           <tr > <td align="left">RAPK + PPH FINAL:</td> <td align="left"><input id="aruskas_project_rapkpph" class="currency" readonly=readonly name="project_rapkpph" style="width:200px;" /></td><td><input id="aruskas_persen_rapkpph"  type="text" style="width:50px;" ></td><td>%</td></tr>
           <tr > <td align="left">PPN WAPU:</td> <td align="left"><input id="aruskas_project_ppn" class="currency" readonly=readonly name="project_ppn" style="width:200px;" /></td><td><input id="aruskas_persen_ppn"  type="text" style="width:50px;" ></td><td>%</td></tr>
           <tr > <td align="left">RAPK + PPH FINAL + PPN WAPU:</td> <td align="left"><input id="aruskas_project_rapkpphppn" class="currency" readonly=readonly name="aruskas_rapkpphppn" style="width:200px;" /></td><td><input  id="aruskas_persen_rapkpphppn"  type="text" style="width:50px;" ></td><td>%</td></tr>
		</table>
        
        <table style="border:1px solid #000;">
			
			<tr > <td align="left"  width="240px">NK - PPN:</td> <td align="left"><input style="width:200px;" readonly id="detail_aruskas_nkppn" class="currency" /></td><td align="left"><input readonly style="width:50px;" id="detail_aruskas_persen_nkppn" value="100" /></td><td>%</td> </tr>
			<tr > <td align="left">RAP Total:</td> <td align="left"><input  style="width:200px;" readonly id="detail_aruskas_raptotal" class="currency" /></td><td align="left"><input readonly style="width:50px;" id="detail_aruskas_persen_raptotal"  /></td><td>%</td> </tr>
			<tr > <td align="left">RAP FLOW:</td> <td align="left"><input  style="width:200px;" readonly id="detail_aruskas_rapflow"  class="currency"/></td><td align="left"><input readonly  style="width:50px;" id="detail_aruskas_persen_rapflow"  /></td><td>%</td> </tr>
            
            
			<tr > <td align="left">&nbsp; a) Droping Cash:</td> <td align="left"><input  style="width:200px;" readonly id="detailflow_aruskas_dropcash" class="currency" /></td><td align="left"><input readonly style="width:50px;" id="detailflow_aruskas_persen_dropcash" /></td><td>%</td> </tr>
            <tr > <td align="left">&nbsp; &nbsp; &nbsp; Drop Reguler:</td> <td align="left"><input  style="width:200px;" class="currency" id="dropcash_arus_dropreg" /></td></tr>
            <tr > <td align="left">&nbsp; &nbsp; &nbsp; Pot PPh KMK/SCH:</td> <td align="left"><input  style="width:200px;" class="currency" id="dropcash_arus_potpph" /></td></tr>
            
			<tr > <td align="left">&nbsp; b) Droping NCL:</td> <td align="left"><input  style="width:200px;" readonly id="detailflow_aruskas_dropncl" class="currency" /></td><td align="left"><input  style="width:50px;" readonly id="detailflow_aruskas_persen_dropncl" /></td><td>%</td> </tr>
            <tr > <td align="left">&nbsp; &nbsp; &nbsp; SKBDN / LC:</td> <td align="left"><input  style="width:200px;" class="currency" id="dropncl_arus_skbdn" /></td></tr>
            <tr > <td align="left">&nbsp; &nbsp; &nbsp; SKBDN / LC Kontrak Payung:</td>  <td align="left"><input  style="width:200px;" class="currency" id="dropncl_arus_skbdnpayung" /></td></tr>
            <tr > <td align="left">&nbsp; &nbsp; &nbsp; KMK:</td>  <td align="left"><input  style="width:200px;" class="currency" id="dropncl_arus_kmk" /></td></tr>
            <tr > <td align="left">&nbsp; &nbsp; &nbsp; SCF:</td> <td align="left"><input  style="width:200px;" class="currency" id="dropncl_arus_scf" /></td></tr>
            
			<tr > <td align="left">&nbsp; c) RAP PPh Final Kontruksi :</td> <td align="left"><input  style="width:200px;" readonly id="detailflow_aruskas_rappph" class="currency"  /></td><td align="left"><input  style="width:50px;" id="detailflow_aruskas_persen_rappph" /></td><td>%</td> </tr>
            
			<tr > <td align="left">&nbsp; d) RAP PPN WAPU:</td> <td align="left"><input  style="width:200px;" readonly id="detailflow_aruskas_rapppn"   class="currency" /></td><td align="left"><input id="detailflow_aruskas_persen_rapppn" style="width:50px;" /></td><td>%</td> </tr>
            
            
			<tr > <td align="left">RAP NON FLOW:</td> <td align="left"><input  style="width:200px;" id="detail_aruskas_rapnonflow" readonly class="currency" /></td><td align="left"><input  style="width:50px;"  id="detail_aruskas_persen_rapnonflow" /></td><td>%</td> </tr>
			<tr>
				<td align="right"><img hidden=hidden class="loading" src="<?php echo base_url("../") ?>assets/images/loader.gif" width=36 height=36></td>
				<td style="padding-top: 10px;" align="right" colspan="3">
					<input style="margin-right: 5px;" type="button" id="btn-save-aruskas" value="Save"  />
					<input style="margin-right: 5px;" type="button" id="btn-saveprint-aruskas" value="Save & Print"  />
					<input id="btn-cancel-aruskas" type="reset" value="Batal" /></td>
			</tr>
		</table>
	</form>